package com.yonyou.distribute.controller;

import com.yonyou.distribute.service.CuratorService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class CuratorController {

    @Resource
    private CuratorService curatorService;

    @GetMapping("/curator/stock/deduct")
    public String deduct2(){
        this.curatorService.deduct();
        return "hello curator stock deduct";
    }

    @GetMapping("/test/zk/read/lock")
    public String testReadLock(){
        curatorService.testReadLock();
        return "hello, testReadLock";
    }

    @GetMapping("/test/zk/write/lock")
    public String testWriteLock(){
        curatorService.testWriteLock();
        return "hello, testWriteLock";
    }


    @GetMapping("/test/semaphore")
    public String testSemaphore(){
        curatorService.testSemaphore();
        return "hello, semaphore";
    }

    @GetMapping("/test/share/count")
    public String testShareCount(){
        curatorService.testShareCount();
        return "hello, testShareCount";
    }
}
